package com.salton123.utils;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.salton123.GlideApp;
import com.salton123.groupbargain.R;
import com.salton123.log.XLog;
import com.salton123.soulove.sdk.BuildConfig;

/**
 * User: newSalton@outlook.com
 * Date: 2019-08-04 12:46
 * ModifyTime: 12:46
 * Description:
 */
public class ImageLoader {


    public static void loadCenterInsideRoundedCorners(ImageView imageView, String url, float sizeMultiplier, int roundingRadius) {
        if (BuildConfig.APP_DEVELOP) {
            XLog.d(ImageLoader.class, "[loadCenterInside] sizeMultiplier:" + sizeMultiplier
                    + ",roundingRadius:" + roundingRadius + ",url:" + url);
        }
        GlideApp.with(imageView)
                .load(url)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .fitCenter()
                .thumbnail(0.5f)
                .into(imageView);
    }

    public static void loadCenterCrop(ImageView imageView, String url) {
        if (BuildConfig.APP_DEVELOP) {
            XLog.d(ImageLoader.class, "[loadCenterCrop]" + ",url:" + url);
        }
        GlideApp.with(imageView)
                .load(url)
                .thumbnail(0.5f)
                .centerCrop()
                .into(imageView);
    }

    public static void loadCenterCrop(ImageView imageView, int resId) {
        if (BuildConfig.APP_DEVELOP) {
            XLog.d(ImageLoader.class, "[loadCenterCrop]" + ",resId:" + resId);
        }
        GlideApp.with(imageView)
                .load(resId)
//                .thumbnail(0.5f)
//                .centerCrop()
                .into(imageView);
    }
}
